﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PRO_DOCS.DAL.Database;
using System.Web.UI.WebControls;

namespace PRO_DOCS.DAL.AppCode
{
    public class Countries : MainClass
    {
        /// <summary>
        /// Loads all countries to combo box.
        /// </summary>
        /// <param name="comboCountries">The combo countries.</param>
        public static void LoadAllCountriesToComboBox(DevExpress.XtraEditors.ComboBoxEdit comboCountries)
        {
            comboCountries.Properties.Items.BeginUpdate();
            comboCountries.Properties.Items.Clear();
            List<DAL.Database.COUNTRy> lstCountries = PRO_DOCSDatabaseDataContext.COUNTRies.ToList();

            for (int i = 0; i < lstCountries.Count; i++)
            {
                comboCountries.Properties.Items.Add(lstCountries[i].COUNTRY_NAME);
            }

            comboCountries.Properties.Items.EndUpdate();
            comboCountries.SelectedIndex = -1;
        }
        /// <summary>
        /// Loads all nationalities to combo box.
        /// </summary>
        /// <param name="comboNationalities">The combo nationalities.</param>
        public static void LoadAllNationalitiesToComboBox(DevExpress.XtraEditors.ComboBoxEdit comboNationalities)
        {
            comboNationalities.Properties.Items.BeginUpdate();
            comboNationalities.Properties.Items.Clear();
            List<DAL.Database.COUNTRy> lstCountries = PRO_DOCSDatabaseDataContext.COUNTRies.ToList();

            for (int i = 0; i < lstCountries.Count; i++)
            {
                comboNationalities.Properties.Items.Add(lstCountries[i].COUNTRY_NATIONALITY);
            }
            comboNationalities.Properties.Items.EndUpdate();
            comboNationalities.SelectedIndex = -1;
        }

    }
}
